<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>添加核心课程</title>


<link type="text/css" rel="stylesheet"
	href="<%=basePath%>css/resources/css/ext-all.css">


<script type="text/javascript" src="<%=basePath%>js/ext-base.js"></script>
<script type="text/javascript" src="<%=basePath%>js/ext-all.js"></script>
<script type="text/javascript" src="<%=basePath%>js/StarHtmleditor.js"></script>

<script type="text/javascript">
			Ext.onReady(function() {
			
			
	var top = new Ext.FormPanel({
        labelAlign: 'top',
        frame:true,
        title: '添加核心课程',
        bodyStyle:'padding:5px 5px 0',
        onSubmit: Ext.emptyFn,
        submit: function(){
        	this.getEl().dom.action='/ztrq/coreCourse?action=add';
        	this.getEl().dom.method='post';
        	this.getEl().dom.submit();
        },
        items: [{
            layout:'column',
            items:[{
                columnWidth:1,
                layout: 'form',
                items: [{
                    xtype:'textfield',
                    fieldLabel: '课程名称',
                    name: 'courseName',
                    id: 'courseName',
                    allowBlank: false,
                    blankText: '课程名称不能为空',
                    anchor:'95%'
                }, {
                    xtype:'textarea',
                    fieldLabel: '课程简介',
                    allowBlank: false,
                    blankText: '课程简介不能为空',
                    name: 'courseRemark',
                    id: 'courseRemark',
                    anchor:'95%'
                }]
            }]
        },{
            xtype:'StarHtmleditor',
            fieldLabel:'课程详细介绍',
            allowBlank: false,
            blankText: '课程详细介绍不能为空',
            height:300,
            name: 'courseIntro',
            id: 'courseIntro',
            anchor:'98%'
        }],

        buttons: [{
            text: '保存',
			handler: function(b,e){
				if (top.form.isValid()) {
					if (/^(&nbsp;)+$/.test((Ext.util.Format.stripTags(top.get('courseIntro').getValue())).trim() )
					|| /^(&nbsp;)+$/.test((Ext.util.Format.stripTags(Ext.get('courseRemark').getValue())).trim() )
					|| top.get('courseIntro').getValue().trim() =='' || Ext.get('courseName').getValue().trim()== ''
					|| Ext.get('courseRemark').getValue().trim()== '') {
						Ext.Msg.alert('','课程名称、课程简介、课程详细介绍都不能空白');
						return;
					}
					top.form.submit();
				}
				
			}
        },{
            text: '取消',
            type: 'reset',
            handler: function(){
            	top.form.reset();
            }
        }]
    });

    top.render(Ext.fly("editor"));	
		
});
			
			</script>

</head>
<body
	style="
	background: url(<%=basePath %>img/bg.jpg) -200px -83px;
	background-attachment: fixed;">

<div id="editor" style="margin: 0 auto; width: 939px; margin-top: 40px">
</div>

</body>


</html>
